package com.ldzy.controller;

import com.ldzy.Exception.MyException;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.servlet.ModelAndView;

@ControllerAdvice
public class ExceptonAdvice
{
//    @ExceptionHandler(MyException.class)
    public ModelAndView doMyException(MyException e){
 ModelAndView modelAndView=new ModelAndView();
 modelAndView.setViewName("error");
 modelAndView.addObject("msg",e.getMessage());
        return modelAndView;
    }
}
